package com.lagou.controller;

import com.github.pagehelper.PageInfo;
import com.lagou.pojo.Article;
import com.lagou.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class ArticleController {

    @Autowired
    private ArticleService articleService;

    @RequestMapping("/list")
    public String list(Model model,int page,int size){
        PageInfo<Article> articlePageInfo = articleService.listByPage(page, size);
        model.addAttribute("page",articlePageInfo);
        return "index";
    }

}